package cc.miwuya.community.service.impl;

import cc.miwuya.community.domain.Property;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cc.miwuya.community.domain.Residential;
import cc.miwuya.community.service.ResidentialService;
import cc.miwuya.community.mapper.ResidentialMapper;
import org.springframework.stereotype.Service;

/**
* @author 杩烽浘妫灄
* @description 针对表【residential(小区表)】的数据库操作Service实现
* @createDate 2024-02-22 20:11:29
*/
@Service
public class ResidentialServiceImpl extends ServiceImpl<ResidentialMapper, Residential>
    implements ResidentialService{

    @Override
    public Object getPage(Page page, String name) {
        Page<Residential> residentialPage = null;
        if (!StrUtil.isEmpty(name)){
            residentialPage = page(page,new QueryWrapper<Residential>().like("name",name));
        }else {
            residentialPage = page(page,new QueryWrapper<Residential>());
        }

        return residentialPage;
    }

    @Override
    public Object getListByPropertyId(Page page, Long id) {
        Page<Residential> residentialPage = null;
        residentialPage = page(page,new QueryWrapper<Residential>().eq("property_id",id));
        return residentialPage;
    }
}




